function loadQuoteData(_urlBase,_quote, _dateIni, _dateFinal,_receiver,_loadFinished)
{
	var fieldDateValue = 0;
	var fieldClosedValue = 4;
	var urlData = getQuoteHistoryDataURL(_urlBase,_dateIni, _dateFinal, _quote.symbol);
	_IG_FetchContent(urlData,function(response)
	{
		var cots = new Array();
		retrievedHistory = response.split("\n");
		for( var i=1;i<retrievedHistory.length-1;i++)
		{
			historyData = retrievedHistory[i].split(",");
			if(historyData.length !=7)  // 7 --> number of fields returned by yahoo
			{
				console.warn("Error loading quote information:\n\tQuote: %s\n\tUrl: %s\n\tRetrieved information: %s",_quote.symbol,urlData,historyData);				
				return;
			}
			cots.push(new Cotation(getDate(historyData[fieldDateValue]),historyData[fieldClosedValue]));
		}
		if(_receiver.constructor==InvestedValue)
		{
			_receiver.addQuoteData(_quote,cots[0]);
		}
		else if(_receiver.constructor==Quote)
		{
			for( var i=0;i<cots.length;i++)
			{
				if(_receiver.getCotation(cots[i].date)== null)
				{
					_receiver.cotations.push(cots[i]);
				}
			}
		}
		_loadFinished();	
	})
}

function getQuoteNameURL(_baseUrl,_quotes)
{
  var quotesSymbols = '';
  
  if(_quotes.length > 0)
  	quotesSymbols = _quotes[0].symbol;
  
   for( var i=1;i<_quotes.length;i++)
   {
     quotesSymbols +='+'+_quotes[i].symbol
   }
  
  return _baseUrl +"?s="+quotesSymbols+"&f=n";
}

 function getQuoteHistoryDataURL(_baseUrl,_dateIni, _dateFinal, _symbol)
		{
	  
		  var urlFinal = _baseUrl +"?a="+_dateIni.getMonth()+"&b="+_dateIni.getDate()+"&c="+_dateIni.getFullYear();
    	urlFinal = urlFinal + "&d="+_dateFinal.getMonth()+"&e="+_dateFinal.getDate()+"&f="+_dateFinal.getFullYear();
    	urlFinal = urlFinal + "&g=d&s="+_symbol;
    	return urlFinal;
		}